
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>GLSL基础 · Aivin开发笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Aivin">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-versions-select/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-local-video/video-js.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../styles/website.css">
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="openglES示例.html" />
    
    
    <link rel="prev" href="openGLES基础.html" />
    

    
        <link rel="shortcut icon" href='../../assets/images/favicon.ico' type="image/x-icon">
    
    
        <link rel="bookmark" href='../../assets/images/favicon.ico' type="image/x-icon">
    
    
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    项目说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../linux/linux基础.html">
            
                <a href="../linux/linux基础.html">
            
                    
                    linux
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../linux/linux基础.html">
            
                <a href="../linux/linux基础.html">
            
                    
                    linux基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../linux/android底层开发.html">
            
                <a href="../linux/android底层开发.html">
            
                    
                    android底层开发
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../c语言/c基础.html">
            
                <a href="../c语言/c基础.html">
            
                    
                    c
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../c语言/c基础.html">
            
                <a href="../c语言/c基础.html">
            
                    
                    c基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../c++/c++基础.html">
            
                <a href="../c++/c++基础.html">
            
                    
                    c++
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../c++/c++基础.html">
            
                <a href="../c++/c++基础.html">
            
                    
                    c++基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../QT/QT基础.html">
            
                <a href="../QT/QT基础.html">
            
                    
                    QT
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../QT/QT基础.html">
            
                <a href="../QT/QT基础.html">
            
                    
                    QT基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../jni/JNI基础.html">
            
                <a href="../jni/JNI基础.html">
            
                    
                    JNI
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../jni/JNI基础.html">
            
                <a href="../jni/JNI基础.html">
            
                    
                    JNI基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../jni/JNI例子.html">
            
                <a href="../jni/JNI例子.html">
            
                    
                    JNI例子
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../SDL/SDL基础.html">
            
                <a href="../SDL/SDL基础.html">
            
                    
                    SDL
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../SDL/SDL基础.html">
            
                <a href="../SDL/SDL基础.html">
            
                    
                    SDL基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../ffmpeg/ffmpeg基础.html">
            
                <a href="../ffmpeg/ffmpeg基础.html">
            
                    
                    ffmpeg
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../ffmpeg/ffmpeg基础.html">
            
                <a href="../ffmpeg/ffmpeg基础.html">
            
                    
                    ffmpeg基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../ffmpeg/ffmpeg示例代码.html">
            
                <a href="../ffmpeg/ffmpeg示例代码.html">
            
                    
                    ffmpeg示例代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../ffmpeg/ffmpeg软解rtsp简单直播.html">
            
                <a href="../ffmpeg/ffmpeg软解rtsp简单直播.html">
            
                    
                    ffmpeg软解rtsp简单直播
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../ffmpeg/rtsp服务器.html">
            
                <a href="../ffmpeg/rtsp服务器.html">
            
                    
                    rtsp服务器Windows
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../opencv/opencv模块.html">
            
                <a href="../opencv/opencv模块.html">
            
                    
                    opencv模块
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../opencv/opencv.html">
            
                <a href="../opencv/opencv.html">
            
                    
                    opencv
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../openSLES/openSLES基础.html">
            
                <a href="../openSLES/openSLES基础.html">
            
                    
                    openSLES
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../openSLES/openSLES基础.html">
            
                <a href="../openSLES/openSLES基础.html">
            
                    
                    openSLES基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../SoundTouch/移植SoundTouch.html">
            
                <a href="../SoundTouch/移植SoundTouch.html">
            
                    
                    SoundTouch
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../SoundTouch/移植SoundTouch.html">
            
                <a href="../SoundTouch/移植SoundTouch.html">
            
                    
                    移植SoundTouch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../SoundTouch/实现音频变速和变调.html">
            
                <a href="../SoundTouch/实现音频变速和变调.html">
            
                    
                    实现音频变速和变调
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="openGLES基础.html">
            
                <a href="openGLES基础.html">
            
                    
                    openGLES模块
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.12.1" data-path="GLSL基础.html">
            
                <a href="GLSL基础.html">
            
                    
                    GLSL基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="openglES示例.html">
            
                <a href="openglES示例.html">
            
                    
                    openglES示例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../视频相关/音视频基础.html">
            
                <a href="../视频相关/音视频基础.html">
            
                    
                    音视频术语-文件格式-协议
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../视频相关/音视频基础.html">
            
                <a href="../视频相关/音视频基础.html">
            
                    
                    音视频基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../视频相关/RTSP.html">
            
                <a href="../视频相关/RTSP.html">
            
                    
                    RTSP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.3" data-path="../视频相关/RTP.html">
            
                <a href="../视频相关/RTP.html">
            
                    
                    RTP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.4" data-path="../视频相关/RTCP.html">
            
                <a href="../视频相关/RTCP.html">
            
                    
                    RTCP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.5" data-path="../视频相关/H264.html">
            
                <a href="../视频相关/H264.html">
            
                    
                    H264
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.6" data-path="../视频相关/YUV.html">
            
                <a href="../视频相关/YUV.html">
            
                    
                    YUV
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.7" data-path="../视频相关/SurfaceView.html">
            
                <a href="../视频相关/SurfaceView.html">
            
                    
                    SurfaceView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.8" data-path="../视频相关/RTMP.html">
            
                <a href="../视频相关/RTMP.html">
            
                    
                    RTMP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.9" data-path="../视频相关/AAC详解.html">
            
                <a href="../视频相关/AAC详解.html">
            
                    
                    AAC详解
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../音视频相关代码/音视频相关代码.html">
            
                <a href="../音视频相关代码/音视频相关代码.html">
            
                    
                    音视频相关代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../ndk/NDK编译基础.html">
            
                <a href="../ndk/NDK编译基础.html">
            
                    
                    NDK工程编译
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../ndk/NDK编译基础.html">
            
                <a href="../ndk/NDK编译基础.html">
            
                    
                    NDK编译基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2" data-path="../ndk/cmake方式.html">
            
                <a href="../ndk/cmake方式.html">
            
                    
                    cmake
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3" data-path="../ndk/Android.mk模板.html">
            
                <a href="../ndk/Android.mk模板.html">
            
                    
                    Android.mk
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4" data-path="../ndk/Application.mk模板.html">
            
                <a href="../ndk/Application.mk模板.html">
            
                    
                    Application.mk
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >GLSL基础</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#glsl"><b>1. </b>GLSL</a></li></ul></div><a href="#glsl" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="glsl"><a name="glsl" class="anchor-navigation-ex-anchor" href="#glsl"><i class="fa fa-link" aria-hidden="true"></i></a>1. GLSL</h1>
<p>OpenGL Shading Language </p>
<table>
<thead>
<tr>
<th>&#x6570;&#x636E;&#x7C7B;&#x578B;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>&#x7A7A;&#x7C7B;&#x578B;</td>
<td>void</td>
</tr>
<tr>
<td>&#x6807;&#x91CF;</td>
<td></td>
</tr>
<tr>
<td>&#x5411;&#x91CF;</td>
<td></td>
</tr>
<tr>
<td>&#x77E9;&#x9635;</td>
<td></td>
</tr>
<tr>
<td>&#x91C7;&#x6837;&#x5668;</td>
<td></td>
</tr>
<tr>
<td>&#x7ED3;&#x6784;&#x4F53;</td>
<td></td>
</tr>
<tr>
<td>&#x6570;&#x7EC4;</td>
<td>&#x53EA;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4E00;&#x7EF4;&#x7684;&#x6570;&#x7EC4;</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>&#x6807;&#x91CF; &#x6570;&#x636E;&#x7C7B;&#x578B;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>bool</td>
<td>true  &#x6216; false</td>
</tr>
<tr>
<td>int</td>
<td>&#x548C;C&#x4E00;&#x6837;&#xFF0C;&#x53EF;&#x4EE5;&#x5199;&#x4E3A;&#x5341;&#x8FDB;&#x5236;&#xFF08;16&#xFF09;&#x3001;&#x516B;&#x8FDB;&#x5236;&#xFF08;020&#xFF09;&#x6216;&#x8005;&#x5341;&#x516D;&#x8FDB;&#x5236;&#xFF08;0x10&#xFF09;</td>
</tr>
<tr>
<td>float</td>
<td></td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>&#x5411;&#x91CF; &#x6570;&#x636E;&#x7C7B;&#x578B;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>bvec2</td>
<td>&#x5305;&#x542B;2&#x4E2A; boolean &#x53D8;&#x91CF;</td>
</tr>
<tr>
<td>bvec3</td>
<td>&#x5305;&#x542B;3&#x4E2A; boolean &#x53D8;&#x91CF;</td>
</tr>
<tr>
<td>bvec4</td>
<td>&#x5305;&#x542B;4&#x4E2A; boolean &#x53D8;&#x91CF;</td>
</tr>
<tr>
<td>ivec2</td>
<td>&#x5305;&#x542B;2&#x4E2A; int &#x53D8;&#x91CF;</td>
</tr>
<tr>
<td>ivec3</td>
<td>&#x5305;&#x542B;3&#x4E2A; int &#x53D8;&#x91CF;</td>
</tr>
<tr>
<td>ivec4</td>
<td>&#x5305;&#x542B;4&#x4E2A; int &#x53D8;&#x91CF;</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>&#x77E9;&#x9635; &#x6570;&#x636E;&#x7C7B;&#x578B;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>mat2x2&#xFF08;mat2</td>
<td>2x2&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x77E9;&#x9635;&#x7C7B;&#x578B;</td>
</tr>
<tr>
<td>mat3x3&#xFF08;mat3&#xFF09;</td>
<td>3x3&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x77E9;&#x9635;&#x7C7B;&#x578B;</td>
</tr>
<tr>
<td>mat4x4</td>
<td>4x4&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x77E9;&#x9635;</td>
</tr>
<tr>
<td>mat2x3</td>
<td>2&#x5217;3&#x884C;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x77E9;&#x9635;</td>
</tr>
<tr>
<td>mat2x4</td>
<td>2&#x5217;4&#x884C;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x77E9;&#x9635;</td>
</tr>
<tr>
<td>mat3x2</td>
<td>3&#x5217;2&#x884C;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x77E9;&#x9635;</td>
</tr>
<tr>
<td>mat3x4</td>
<td>3&#x5217;4&#x884C;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x77E9;&#x9635;</td>
</tr>
<tr>
<td>mat4x2</td>
<td>4&#x5217;2&#x884C;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x77E9;&#x9635;</td>
</tr>
<tr>
<td>mat4x3</td>
<td>4&#x5217;3&#x884C;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x77E9;&#x9635;</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>&#x91C7;&#x6837;&#x5668; &#x6570;&#x636E;&#x7C7B;&#x578B;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>sampler1D</td>
<td>&#x7528;&#x4E8E;&#x5185;&#x5EFA;&#x7684;&#x7EB9;&#x7406;&#x51FD;&#x6570;&#x4E2D;&#x5F15;&#x7528;&#x6307;&#x5B9A;&#x7684;1D&#x7EB9;&#x7406;&#x7684;&#x53E5;&#x67C4;&#x3002;<br>&#x53EA;&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x4E00;&#x81F4;&#x53D8;&#x91CF;&#x6216;&#x8005;&#x51FD;&#x6570;&#x53C2;&#x6570;&#x4F7F;&#x7528;</td>
</tr>
<tr>
<td>sampler2D</td>
<td>&#x4E8C;&#x7EF4;&#x7EB9;&#x7406;&#x53E5;&#x67C4;</td>
</tr>
<tr>
<td>sampler3D</td>
<td>&#x4E09;&#x7EF4;&#x7EB9;&#x7406;&#x53E5;&#x67C4;</td>
</tr>
<tr>
<td>samplerCube</td>
<td>cube map&#x7EB9;&#x7406;&#x53E5;&#x67C4;</td>
</tr>
<tr>
<td>sampler1DShadow</td>
<td>&#x4E00;&#x7EF4;&#x6DF1;&#x5EA6;&#x7EB9;&#x7406;&#x53E5;&#x67C4;</td>
</tr>
<tr>
<td>sampler2DShadow</td>
<td>&#x4E8C;&#x7EF4;&#x6DF1;&#x5EA6;&#x7EB9;&#x7406;&#x53E5;&#x67C4;</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>&#x4FEE;&#x9970;&#x7B26;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>const</td>
<td>&#x53EA;&#x8BFB; ,&#x4E0D;&#x53EF;&#x4FEE;&#x6539;</td>
</tr>
<tr>
<td>attribute</td>
<td>&#x53EA;&#x8BFB;&#x7684;&#x9876;&#x70B9;&#x6570;&#x636E;&#x3002;<br>&#x53EF;&#x4EE5;&#x662F;&#x6D6E;&#x70B9;&#x6570;&#x7C7B;&#x578B;&#x7684;&#x6807;&#x91CF;&#xFF0C;&#x5411;&#x91CF;&#xFF0C;&#x6216;&#x8005;&#x77E9;&#x9635;&#x3002;&#x4E0D;&#x53EF;&#x4EE5;&#x662F;&#x6570;&#x7EC4;&#x6216;&#x5219;&#x7ED3;&#x6784;&#x4F53;</td>
</tr>
<tr>
<td>uniform</td>
<td>&#x4E00;&#x81F4;&#x53D8;&#x91CF;&#x3002;&#x5728;&#x7740;&#x8272;&#x5668;&#x6267;&#x884C;&#x671F;&#x95F4;&#x4E00;&#x81F4;&#x53D8;&#x91CF;&#x7684;&#x503C;&#x662F;&#x4E0D;&#x53D8;&#x7684;</td>
</tr>
<tr>
<td>varying</td>
<td>&#x9876;&#x70B9;&#x7740;&#x8272;&#x5668;&#x7684;&#x8F93;&#x51FA;&#x3002;<br>&#x53EF;&#x4EE5;&#x662F;&#x6D6E;&#x70B9;&#x6570;&#x7C7B;&#x578B;&#x7684;&#x6807;&#x91CF;&#xFF0C;&#x5411;&#x91CF;&#xFF0C;&#x77E9;&#x9635;&#x3002;&#x4E0D;&#x80FD;&#x662F;&#x6570;&#x7EC4;&#x6216;&#x8005;&#x7ED3;&#x6784;&#x4F53;</td>
</tr>
<tr>
<td>centorid varying</td>
<td>&#x5728;&#x6CA1;&#x6709;&#x591A;&#x91CD;&#x91C7;&#x6837;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x4E0E;varying&#x662F;&#x4E00;&#x6837;&#x7684;&#x610F;&#x601D;&#x3002;<br>&#x5728;&#x591A;&#x91CD;&#x91C7;&#x6837;&#x65F6;&#xFF0C;centorid varying&#x5728;&#x5149;&#x6805;&#x5316;&#x7684;&#x56FE;&#x5F62;&#x5185;&#x90E8;&#x8FDB;&#x884C;&#x6C42;&#x503C;&#x800C;&#x4E0D;&#x662F;&#x5728;&#x7247;&#x6BB5;&#x4E2D;&#x5FC3;&#x7684;&#x56FA;&#x5B9A;&#x4F4D;&#x7F6E;&#x6C42;&#x503C;</td>
</tr>
<tr>
<td>invariant</td>
<td>&#x8868;&#x793A;&#x9876;&#x70B9;&#x7740;&#x8272;&#x5668;&#x7684;&#x8F93;&#x51FA;&#x548C;&#x4EFB;&#x4F55;&#x5339;&#x914D;&#x7247;&#x6BB5;&#x7740;&#x8272;&#x5668;&#x7684;&#x8F93;&#x5165;</td>
</tr>
<tr>
<td>in</td>
<td>&#x7528;&#x5728;&#x51FD;&#x6570;&#x7684;&#x53C2;&#x6570;&#x4E2D;&#xFF0C;&#x8868;&#x793A;&#x8FD9;&#x4E2A;&#x53C2;&#x6570;&#x662F;&#x8F93;&#x5165;&#x7684;</td>
</tr>
<tr>
<td>out</td>
<td>&#x7528;&#x5728;&#x51FD;&#x6570;&#x7684;&#x53C2;&#x6570;&#x4E2D;&#xFF0C;&#x8868;&#x793A;&#x8BE5;&#x53C2;&#x6570;&#x662F;&#x8F93;&#x51FA;&#x53C2;&#x6570;</td>
</tr>
<tr>
<td>inout</td>
<td>&#x7528;&#x5728;&#x51FD;&#x6570;&#x7684;&#x53C2;&#x6570;&#xFF0C;&#x8868;&#x793A;&#x8FD9;&#x4E2A;&#x53C2;&#x6570;&#x5373;&#x662F;&#x8F93;&#x5165;&#x53C2;&#x6570;&#x4E5F;&#x662F;&#x8F93;&#x51FA;&#x53C2;&#x6570;</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>&#x9876;&#x70B9;&#x7740;&#x8272;&#x5668; &#x5185;&#x7F6E;&#x53D8;&#x91CF;</th>
<th>&#x7C7B;&#x578B;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>gl_Color</td>
<td>vec4</td>
<td>&#x8F93;&#x5165;&#x5C5E;&#x6027;&#x3002;&#x8868;&#x793A;&#x9876;&#x70B9;&#x7684;&#x4E3B;&#x989C;&#x8272;</td>
</tr>
<tr>
<td>gl_SecondaryColor</td>
<td>vec4</td>
<td>&#x8F93;&#x5165;&#x5C5E;&#x6027;&#x3002;&#x8868;&#x793A;&#x9876;&#x70B9;&#x7684;&#x8F85;&#x52A9;&#x989C;&#x8272;</td>
</tr>
<tr>
<td>gl_Normal</td>
<td>vec3</td>
<td>&#x8F93;&#x5165;&#x5C5E;&#x6027;&#x3002;&#x8868;&#x793A;&#x9876;&#x70B9;&#x7684;&#x6CD5;&#x7EBF;&#x503C;</td>
</tr>
<tr>
<td>gl_Vertex</td>
<td>vec4</td>
<td>&#x8F93;&#x5165;&#x5C5E;&#x6027;&#x3002;&#x8868;&#x793A;&#x7269;&#x4F53;&#x7A7A;&#x95F4;&#x7684;&#x9876;&#x70B9;&#x4F4D;&#x7F6E;</td>
</tr>
<tr>
<td>gl_MultiTexCoordn</td>
<td>vec4</td>
<td>&#x8F93;&#x5165;&#x5C5E;&#x6027;&#x3002;&#x8868;&#x793A;&#x9876;&#x70B9;&#x7684;&#x7B2C;n&#x4E2A;&#x7EB9;&#x7406;&#x7684;&#x5750;&#x6807;</td>
</tr>
<tr>
<td>gl_FogCoord</td>
<td>float</td>
<td>&#x8F93;&#x5165;&#x5C5E;&#x6027;&#x3002;&#x8868;&#x793A;&#x9876;&#x70B9;&#x7684;&#x96FE;&#x5750;&#x6807;</td>
</tr>
<tr>
<td>gl_Position</td>
<td>vec4</td>
<td>&#x9876;&#x70B9;&#x7684;&#x4F4D;&#x7F6E;&#x3002;</td>
</tr>
<tr>
<td>gl_ClipVertex</td>
<td>vec4</td>
<td>&#x8F93;&#x51FA;&#x5750;&#x6807;&#x3002;&#x7528;&#x4E8E;&#x7528;&#x6237;&#x88C1;&#x526A;&#x5E73;&#x9762;&#x7684;&#x88C1;&#x526A;</td>
</tr>
<tr>
<td>gl_PointSize</td>
<td>float</td>
<td>&#x70B9;&#x7684;&#x5927;&#x5C0F;</td>
</tr>
<tr>
<td>gl_FrontColor</td>
<td>vec4</td>
<td>&#x6B63;&#x9762;&#x7684;&#x4E3B;&#x989C;&#x8272;&#x7684;varying&#x8F93;&#x51FA;</td>
</tr>
<tr>
<td>gl_BackColor</td>
<td>vec4</td>
<td>&#x80CC;&#x9762;&#x4E3B;&#x989C;&#x8272;&#x7684;varying&#x8F93;&#x51FA;</td>
</tr>
<tr>
<td>gl_FrontSecondaryColor</td>
<td>vec4</td>
<td>&#x6B63;&#x9762;&#x7684;&#x8F85;&#x52A9;&#x989C;&#x8272;&#x7684;varying&#x8F93;&#x51FA;</td>
</tr>
<tr>
<td>gl_BackSecondaryColor</td>
<td>vec4</td>
<td>&#x80CC;&#x9762;&#x7684;&#x8F85;&#x52A9;&#x989C;&#x8272;&#x7684;varying&#x8F93;&#x51FA;</td>
</tr>
<tr>
<td>gl_TexCoord[]</td>
<td>vec4</td>
<td>&#x7EB9;&#x7406;&#x5750;&#x6807;&#x7684;&#x6570;&#x7EC4;varying&#x8F93;&#x51FA;</td>
</tr>
<tr>
<td>gl_FogFragCoord</td>
<td>float</td>
<td>&#x96FE;&#x5750;&#x6807;&#x7684;varying&#x8F93;&#x51FA;</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>&#x7247;&#x6BB5;&#x7740;&#x8272;&#x5668; &#x5185;&#x7F6E;&#x53D8;&#x91CF;</th>
<th>&#x7C7B;&#x578B;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>gl_Color</td>
<td>vec4</td>
<td>&#x5305;&#x542B;&#x4E3B;&#x989C;&#x8272;&#x7684;&#x63D2;&#x503C;&#x53EA;&#x8BFB;&#x8F93;&#x5165;</td>
</tr>
<tr>
<td>gl_SecondaryColor</td>
<td>vec4</td>
<td>&#x5305;&#x542B;&#x8F85;&#x52A9;&#x989C;&#x8272;&#x7684;&#x63D2;&#x503C;&#x53EA;&#x8BFB;&#x8F93;&#x5165;</td>
</tr>
<tr>
<td>gl_TexCoord[]</td>
<td>vec4</td>
<td>&#x5305;&#x542B;&#x7EB9;&#x7406;&#x5750;&#x6807;&#x6570;&#x7EC4;&#x7684;&#x63D2;&#x503C;&#x53EA;&#x8BFB;&#x8F93;&#x5165;</td>
</tr>
<tr>
<td>gl_FogFragCoord</td>
<td>float</td>
<td>&#x5305;&#x542B;&#x96FE;&#x5750;&#x6807;&#x7684;&#x63D2;&#x503C;&#x53EA;&#x8BFB;&#x8F93;&#x5165;</td>
</tr>
<tr>
<td>gl_FragCoord</td>
<td>vec4</td>
<td>&#x53EA;&#x8BFB;&#x8F93;&#x5165;&#x3002;&#x7A97;&#x53E3;&#x7684;x,y,z&#x548C;1/w</td>
</tr>
<tr>
<td>gl_FrontFacing</td>
<td>bool</td>
<td>&#x53EA;&#x8BFB;&#x8F93;&#x5165;&#x3002;<br>&#x5982;&#x679C;&#x662F;&#x7A97;&#x53E3;&#x6B63;&#x9762;&#x56FE;&#x5143;&#x7684;&#x4E00;&#x90E8;&#x5206;&#xFF0C;&#x5219;&#x8FD9;&#x4E2A;&#x503C;&#x4E3A;true</td>
</tr>
<tr>
<td>gl_PointCoord</td>
<td>vec2</td>
<td>&#x70B9;&#x7CBE;&#x7075;&#x7684;&#x4E8C;&#x7EF4;&#x7A7A;&#x95F4;&#x5750;&#x6807;&#x8303;&#x56F4;&#x5728;(0.0, 0.0)&#x5230;(1.0, 1.0)&#x4E4B;&#x95F4;&#x3002;<br>&#x4EC5;&#x7528;&#x4E8E;&#x70B9;&#x56FE;&#x5143;&#x548C;&#x70B9;&#x7CBE;&#x7075;&#x5F00;&#x542F;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#x3002;</td>
</tr>
<tr>
<td>gl_FragData[]</td>
<td>vec4</td>
<td>&#x4F7F;&#x7528;glDrawBuffers&#x8F93;&#x51FA;&#x7684;&#x6570;&#x636E;&#x6570;&#x7EC4;&#x3002;&#x4E0D;&#x80FD;&#x4E0E;gl_FragColor&#x7ED3;&#x5408;&#x4F7F;&#x7528;&#x3002;</td>
</tr>
<tr>
<td>gl_FragColor</td>
<td>vec4</td>
<td>&#x7247;&#x5143;&#x989C;&#x8272;</td>
</tr>
<tr>
<td>gl_FragDepth</td>
<td>float</td>
<td>&#x8F93;&#x51FA;&#x7684;&#x6DF1;&#x5EA6;&#x7528;&#x4E8E;&#x968F;&#x540E;&#x7684;&#x50CF;&#x7D20;&#x64CD;&#x4F5C;&#x3002;<br>&#x5982;&#x679C;&#x8FD9;&#x4E2A;&#x503C;&#x6CA1;&#x6709;&#x88AB;&#x5199;&#xFF0C;&#x5219;&#x4F7F;&#x7528;&#x56FA;&#x5B9A;&#x529F;&#x80FD;&#x7BA1;&#x7EBF;&#x7684;&#x6DF1;&#x5EA6;&#x503C;&#x4EE3;&#x66FF;</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>&#x5E38;&#x7528;&#x5185;&#x7F6E;&#x51FD;&#x6570;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td>&#x5728;&#x6240;&#x6709;&#x4E3A;&#x771F;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x8FD4;&#x56DE;&#x4E3A;&#x771F;&#xFF1B;</td>
</tr>
<tr>
<td>any</td>
<td>&#x5728;&#x4EFB;&#x4E00;&#x53D8;&#x91CF;&#x4E3A;&#x771F;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x8FD4;&#x56DE;&#x4E3A;&#x771F;&#xFF1B;</td>
</tr>
<tr>
<td>dot</td>
<td>&#x5411;&#x91CF;&#x70B9;&#x4E58;</td>
</tr>
<tr>
<td>cross</td>
<td>&#x5411;&#x91CF;&#x7684;&#x53C9;&#x79EF;</td>
</tr>
<tr>
<td>ceil(x)</td>
<td>&#x5411;&#x4E0A;&#x53D6;&#x6574; &#x5982;&#xFF1A;ceil(3.5) &#x503C;&#x4E3A;4</td>
</tr>
<tr>
<td>floor(x)</td>
<td>&#x5411;&#x4E0B;&#x53D6;&#x6574; &#x5982;&#xFF1A;floor(3.5) &#x503C;&#x4E3A;3</td>
</tr>
<tr>
<td>pow(x,y)</td>
<td>&#x6C42;x&#x7684;y&#x6B21;&#x65B9;</td>
</tr>
<tr>
<td>exp(x)</td>
<td>&#x81EA;&#x7136;&#x6307;&#x6570;e&#x7684;x&#x6B21;&#x65B9;</td>
</tr>
<tr>
<td>exp2(x)</td>
<td>2&#x7684;x&#x6B21;&#x65B9;</td>
</tr>
<tr>
<td>transpose</td>
<td>&#x77E9;&#x9635;&#x6C42;&#x8F6C;&#x7F6E;&#x77E9;&#x9635;</td>
</tr>
<tr>
<td>determinant</td>
<td>&#x6C42;&#x884C;&#x5217;&#x5F0F;</td>
</tr>
<tr>
<td>inverse</td>
<td>&#x77E9;&#x9635;&#x6C42;&#x9006;&#x77E9;&#x9635;</td>
</tr>
<tr>
<td>distance</td>
<td>&#x8BA1;&#x7B97;&#x4E24;&#x70B9;&#x7684;&#x8DDD;&#x79BB;</td>
</tr>
<tr>
<td>length</td>
<td>&#x6C42;&#x89E3;&#x5411;&#x91CF;&#x7684;&#x957F;&#x5EA6;</td>
</tr>
<tr>
<td>normalize</td>
<td>&#x5BF9;&#x4E00;&#x4E2A;&#x5411;&#x91CF;&#x8FDB;&#x884C;&#x6807;&#x51C6;&#x5316;</td>
</tr>
<tr>
<td>clamp</td>
<td>&#x5C06;&#x4E00;&#x4E2A;&#x503C;&#x622A;&#x53D6;&#x5230;&#x4E24;&#x4E2A;&#x503C;&#x4E4B;&#x95F4;</td>
</tr>
<tr>
<td>matrixCompMult</td>
<td>&#x5728;&#x4E24;&#x4E2A;&#x77E9;&#x9635;&#x4E4B;&#x95F4;&#x6267;&#x884C;&#x4E00;&#x4E2A;&#x9010;&#x5206;&#x91CF;&#x7684;&#x64CD;&#x4F5C;</td>
</tr>
<tr>
<td>outerProduct</td>
<td>&#x63D0;&#x53D6;&#x4E24;&#x4E2A;&#x5411;&#x91CF;&#x7684;&#x5916;&#x79EF;&#x3002;<br>&#x5C31;&#x662F;&#x5C06;&#x4E00;&#x4E2A;n<em>1&#x7684;&#x5411;&#x91CF;&#x4E0E;1</em> m&#x7684;&#x5411;&#x91CF;&#x76F8;&#x4E58;&#xFF0C;&#x5F97;&#x5230;&#x4E00;&#x4E2A;n*m&#x7684;&#x77E9;&#x9635;</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>&#x7CBE;&#x5EA6;&#x7EA7;&#x522B;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>lowp</td>
<td></td>
</tr>
<tr>
<td>mediump</td>
<td></td>
</tr>
<tr>
<td>highp</td>
<td>precision highp float; <br> &#x5B9A;&#x4E49;&#x5728; float &#x7C7B;&#x578B;&#x9ED8;&#x8BA4;&#x4F7F;&#x7528; highp &#x7EA7;&#x522B;&#x7684;&#x7CBE;&#x5EA6;</td>
</tr>
</tbody>
</table>
<footer class="page-footer"><span class="copyright">&#x65E0;&#x7248;&#x6743; &#x53EF;&#x4EE5;&#x65E0;&#x9650;&#x5236;&#x4F7F;&#x7528;&#xFF01; all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x66F4;&#x65B0;&#x65F6;&#x95F4;&#xFF1A;
2019-12-18 14:42:27
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="openGLES基础.html" class="navigation navigation-prev " aria-label="Previous page: openGLES模块">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="openglES示例.html" class="navigation navigation-next " aria-label="Next page: openglES示例">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"GLSL基础","level":"1.12.1","depth":2,"next":{"title":"openglES示例","level":"1.12.2","depth":2,"path":"chinese/openGLES/openglES示例.md","ref":"chinese/openGLES/openglES示例.md","articles":[]},"previous":{"title":"openGLES模块","level":"1.12","depth":1,"path":"chinese/openGLES/openGLES基础.md","ref":"chinese/openGLES/openGLES基础.md","articles":[{"title":"GLSL基础","level":"1.12.1","depth":2,"path":"chinese/openGLES/GLSL基础.md","ref":"chinese/openGLES/GLSL基础.md","articles":[]},{"title":"openglES示例","level":"1.12.2","depth":2,"path":"chinese/openGLES/openglES示例.md","ref":"chinese/openGLES/openglES示例.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["-search","search-plus","todo","anchor-navigation-ex","copy-code-button","versions-select","fontsettings","sharing","tbfed-pagefooter","donate","local-video","splitter","edit-link","expandable-chapters","favicon","theme-comscore","local-video"],"styles":{"website":"styles/website.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"无版权 可以无限制使用！","modify_label":"该文件更新时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"todo":{},"splitter":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"versions-select":{"type":"branches"},"donate":{"alipay":"https://gitee.com/hnyer/filesOfGitbook/raw/master/files/201803011956_osChina_支付宝收款码.png","alipayText":"支付宝打赏","button":"打赏","title":"","wechat":"https://gitee.com/hnyer/filesOfGitbook/raw/master/files/201803011956_osChina_微信收款码.png","wechatText":"微信打赏"},"fontsettings":{"family":"sans","size":2,"theme":"sepia"},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"favicon":{"shortcut":"assets/images/favicon.ico","bookmark":"assets/images/favicon.ico"},"theme-comscore":{},"local-video":{},"copy-code-button":{},"versions":{"options":[{"value":"https://www.aivin666.cn/java_android/","text":"v1.0"}]},"sharing":{"all":["facebook","google","twitter","weibo","instapaper"],"facebook":false,"google":true,"instapaper":false,"twitter":false,"vk":false,"weibo":true},"edit-link":{"label":"托管页面","base":"https://www.baidu.com/"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"Aivin","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Aivin开发笔记","language":"zh-hans","gitbook":"*","description":"Aivin开发笔记"},"file":{"path":"chinese/openGLES/GLSL基础.md","mtime":"2019-12-18T06:42:27.166Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-12-24T10:38:14.517Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-versions-select/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-local-video/video.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-edit-link/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

